﻿using Microsoft.AspNetCore.Mvc.ModelBinding;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Threading.Tasks;

namespace NetCoreProject.Api.Common
{
    public static class ValidationHelper
    {
        public static string TranslateError(ModelStateDictionary modelState)
        {
            string error = string.Join("\n", modelState.Values.SelectMany(x => x.Errors).First().ErrorMessage);
            return !string.IsNullOrWhiteSpace(error) ? error : "指定参数类型不匹配";
        }

        public static bool ValidationToken(string Token="") 
        {
            if (string.IsNullOrEmpty(Token)) 
            {
                return false;
            }
            JwtSecurityToken Jwt = new JwtSecurityToken();
            
        }
    }
}
